############# ########### ####### ##### ### ##
#
# Copyright (C) 2010 The Hursk Group, LLC
#
# This program is free software: you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (See file named COPYING).  If not, see 
# <http://www.gnu.org/licenses/>.
# 
############# ########### ####### ##### ### ##


#!/usr/bin/perl -w

&GpgEnc(@ARGV);
#THE FOLLOWING IS SECURE:
 sub GpgEnc($){
    # initialize variable
    my($PSTG, $GPGC, $HDIR, $RCPT, $TPFN);

    # set variable
    $ENV{'PATH'} = '';                    # set file path
    $PSTG = $_[0];                        # plain string
    $GPGC = '/bin/cat';         # gpg command
    $HDIR = '/export/home/nobody/.gnupg'; # gpg pubring home_dir
    $RCPT = ''; # recipient mail_address
    $TPFN = '/tmp/gpg_tmp' . $$;          # temporary file name

    # execute gpg command
    open( CMD, "| $GPGC" );
        print CMD $PSTG;
    close(CMD);
    $PSTG = '';
 }
#THE FOLLOWING IS INSECURE:
# my $string = '> test.t';
# $CAT = '/bin/cat';
# open PIPE, "$CAT \"$string\" |" or
#    die "Cannot open pipe to figlet: $!";
# 
#print $q->header( "text/plain" );
#print while <PIPE>;
#close PIPE;
